package com.lzy.business.response.excel;

import com.lzy.framework.core.excel.annotation.ExcelColumn;
import com.lzy.product.constants.AgentOrderEnum;

import java.math.BigDecimal;

/**
 * 代理商产品dto映射excel
 */
public class AgentProductOrderReponse {

    /**
     * 商品信息
     */
    @ExcelColumn(value = "商品信息", sort = 0, width = 256 * 30)
    private String product;

    /**
     * 商家名称
     */
    @ExcelColumn(value = "商家名称", sort = 1, width = 256 * 30)
    private String shop;

    /**
     * 下单信息
     */
    @ExcelColumn(value = "下单信息", sort = 2, width = 256 * 30)
    private String order;

    /**
     * 单价
     */
    @ExcelColumn(value = "单价", sort = 3, width = 256 * 15)
    private BigDecimal salePrice;

    /**
     * 订单金额
     */
    @ExcelColumn(value = "订单金额", sort = 4, width = 256 * 15)
    private BigDecimal moneyCount;

    /**
     * 订单状态
     */
    @ExcelColumn(value = "订单状态", sort = 5, width = 256 * 15)
    private String status;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = getStatusNameByKey(status);
    }

    public BigDecimal getMoneyCount() {
        return moneyCount;
    }

    public void setMoneyCount(BigDecimal moneyCount) {
        this.moneyCount = moneyCount;
    }

    public BigDecimal getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public String getShop() {
        return shop;
    }

    public void setShop(String shop) {
        this.shop = shop;
    }

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product;
    }

    /**
     * 根据订单状态枚举key取得value
     *
     * @param k
     * @return
     */
    private String getStatusNameByKey(String k) {
        AgentOrderEnum.OrderStatus orderStatus[] = AgentOrderEnum.OrderStatus.values();
        for (AgentOrderEnum.OrderStatus orderStatus1 : orderStatus) {
            if (orderStatus1.getCode().toString().equals(k)) {
                return orderStatus1.getDesc();
            }
        }
        return null;
    }

}
